<template>
	<view class="box">
		<u-navbar :title="title" @leftClick="leftClick" :autoBack="true"></u-navbar>
		<view class="list" v-for="(item,index) in list" :key="index">
			<view class="tiem">
				{{item.createTime}}
			</view>
			<view class="card">
				<view v-html="item.message"></view>
			</view>
		</view>
		<view class="empty">
			<u-empty mode="data" text="暂无通知" v-if="list.length==0"></u-empty>
		</view>
		<u-toast ref="uToast"></u-toast>
	</view>
</template>

<script>
	import {
		getuserinfo
	} from '../../api/my/index.js'
	export default {
		data() {
			return {
				id: 0,
				title:'租约即将到期',
				list: []
			}
		},
		onLoad(option) {
		    if(option.id) {
				this.id = option.id
				if(this.id == '0'){
					this.title="租约即将到期"
				}else{
					this.title="服务费收取"
				}
			}		
		},
		mounted() {
			this.userinfo(this.id)
		},
		methods: {
			leftClick(){
				uni.navigateBack(-1)
			},
			async userinfo(id) {
			
				const res = await getuserinfo(id)
				this.list = res.data.rows;
				
			}
		}
	}
</script>

<style lang="scss" scoped>
	@import "~@/styles/index.scss";
	@import "~@/styles/global.scss";

	.box {
		@include pageInit;
		padding-top: 30rpx;
		font-size: 28rpx;
		min-height: 100vh;

		.list {
			.tiem {
				text-align: center;
				color: #ccc;
				padding-top: 50rpx;
				padding-bottom: 30rpx;
			}

			.card {
				padding: 20rpx;
				border-radius: 10rpx;
				background-color: #fff;
				color: $noimportant;

				.button_box {
					width: 18%;
					margin-left: auto;
					margin-top: 20rpx;
				}
			}
		}

		.empty {
			padding-top: 400rpx;
		}

	}
</style>